package org.marsdonne.commons;

import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import java.io.Serializable;

public class ScheduledMessenger {
    private static final String ScheduledDeliveryProperty = "_AMQ_SCHED_DELIVERY";

    protected ObjectMessage scheduleDeliveryMessage(Session session, Serializable content, long delay) throws JMSException {
        ObjectMessage message = session.createObjectMessage(content);
        message.setLongProperty(ScheduledDeliveryProperty, delay);
        return message;
    }
}
